<template>
  <div>
    <div class="style2-actions clearfix mgt10">
      <div class="style2-actions-title">我的服务</div>
      <!-- 我的佣金 -->
      <div @click="Jump('myCommission','fxs')" v-if="storeInfo.show_md_commission" class="action">
        <span class="icon-action icon2_9"></span>
        <span class="title">{{storeInfo.ftitle_commission}}</span>
      </div>
      <!-- 上月佣金排名 -->
      <div  @click="Jump('commissionSort')" v-if="storeInfo.display_agent_sort && storeInfo.show_md_lastCommission" class="action">
        <span class="icon-action icon2_10"></span>
        <span class="title">{{storeInfo.ftitle_ranking}}</span>
      </div>
      <!--  我的上级  -->
      <div @click="Jump('fxsDirector')" v-if="storeInfo.show_md_superior && storeInfo.superior_user_id" class="action">
        <span class="icon-action icon2_13"></span>
        <span class="title">{{storeInfo.ftitle_superior}}</span>
        <span class="subtitle">{{storeInfo.superior_user}}</span>
      </div>
      <!-- 微信扫码 -->
      <div @click="_wxScanner()" v-if="storeInfo.show_md_code && storeInfo.is_wx==1" class="action">
        <span class="icon-action icon2_15"></span>
        <span class="title">扫码核销</span>
      </div>
      <!--  我的员工  -->
      <div @click="Jump('staff-list')" v-if="storeInfo.show_md_staff" class="action">
        <span class="icon-action icon3_2"></span>
        <span class="title">我的员工</span>
      </div>
      <!-- 店中店 -->
      <div @click="Jump('store')" v-if="!storeInfo.is_app_open && storeInfo.is_store_log == 1 && storeInfo.show_md_myStore" class="action"> 
        <span class="icon-action icon2_11"></span>
        <span class="title">{{storeInfo.ftitle_store}}</span>
      </div>
      <!-- 门店订单 -->
      <div @click="Jump('storeOrderList')" v-if="storeInfo.show_md_order" class="action">
        <span class="icon-action icon2_29"></span>
        <span class="title">门店订单</span>
        <span class="order-num" v-if="storeInfo.total_store_order_count">{{storeInfo.total_store_order_count}}</span>
      </div>
      <!-- 服务订单 -->
      <div @click="Jump('serve-order')" class="action" v-if="storeInfo.is_store_serve_order">
        <span class="icon-action icon2_30"></span>
        <span class="title">{{storeInfo.ftitle_store_serve_order}}</span>
      </div>
      <!-- 优惠券核销 -->
      <div @click="Jump('writeOffCoupons')" class="action" v-if="storeInfo.show_coupon_verify">
        <span class="icon-action icon2_32"></span>
        <span class="title">优惠券核销</span>
      </div>
      <!-- 门店库存 -->
      <div @click="Jump('storeInventory')" class="action" v-if="storeInfo.show_store_inventory">
        <span class="icon-action icon2_33"></span>
        <span class="title">门店库存</span>
      </div>
      <!-- 供货订单 -->
      <div @click="Jump('listsGys')" v-if="storeInfo.is_smart_store == 1" class="action">
        <span class="icon-action icon2_4"></span>
        <span class="title">供货订单</span>
      </div>
      <!-- 供货商品 -->
      <div @click="Jump('supplierItems')" v-if="storeInfo.is_smart_store == 1" class="action">
        <span class="icon-action icon2_2"></span>
        <span class="title">供货商品</span>
      </div>
      <!-- 供货收入 -->
      <div @click="Jump('supplierWithdraw')" v-if="storeInfo.is_smart_store == 1" class="action">
        <span class="icon-action icon2_14"></span>
        <span class="title">供货收入</span>
      </div>

      <div @click="Jump('/shareSelect')" v-if="storeInfo.common_center_renovation_parameter.showShareLinkStore" class="action">
        <span class="icon-action icon20_1_fx"></span>
        <span class="title">万能链接</span>
      </div>
      <!-- 视频号数据 -->
      <div @click="Jump('venderOrder', 'live')" class="action" v-if="storeInfo.show_video_num_data_store">
        <span class="icon-action icon_sphsj"></span>
        <span class="title">视频号数据</span>
      </div>
      <!-- 自定义项 -->
      <div v-if="storeInfo.dataset_store && storeInfo.dataset_store.length>0"
            v-for="(item,index) in storeInfo.dataset_store"
            :key="index"
            class="action">
        <a @click="JumpUrl(item.link)">
          <span class="icon-action"
                :style="{backgroundImage: 'url('+item.pic+')',backgroundSize:'cover'}"></span>
          <span class="title">{{item.showtitle}}</span>
        </a>
      </div>
    </div>
  </div>
</template>

<script>
import { openPage } from '@/utils/utils.js'
import Vue from 'vue'
export default Vue.extend({
  props: {
    storeInfo: {
      type: Object
    }
  },
  methods: {
    linkTo(url) {
      window.location.href = url
    },
    Jump(url, type) {
      const data = { type }
      this.$JumpPath(this, url, data)
    },
    JumpUrl(link) {
      openPage(link)
    },
    _wxScanner() {
      // TODO 小程序扫码
        wx.scanCode({
          success: (res) => {
            // console.log(res)
            openPage(res.result)
          }
        })
    },
    _show_qrcode() {
      this.$emit('showQrcode')
    }
  }
})
</script>

<style lang="scss">
@import 'src/styles/user/index.scss';
.order-num {
  color: #999;
  position: absolute;
  font-size: 20px;
  color: #fff;
  min-width: 30px;
  line-height: 30px;
  border-radius: 15px;
  padding: 0 5px;
  background: #F20B22;
  top: 20px;
  right: 40px;
}
</style>
